﻿

using CoreWCF;
using System.ServiceModel;
namespace Digitalmes.Services.Wcf
{


    /// <summary>
    /// Defines the <see cref="IWcfService" />
    /// </summary>
    [ServiceContract] // 标明这是一个WCF服务契约
    public interface IWcfService
    {
        /// <summary>
        /// The GetDataAsync
        /// </summary>
        /// <param name="value">The value<see cref="int"/></param>
        /// <returns>The <see cref="Task{string}"/></returns>
        [OperationContract] // 标明这是一个WCF操作/方法
        Task<string> GetDataAsync(int value);

        /// <summary>
        /// The GetDataUsingDataContractAsync
        /// </summary>
        /// <param name="composite">The composite<see cref="CompositeType"/></param>
        /// <returns>The <see cref="Task{CompositeType}"/></returns>
        [OperationContract]
        Task<CompositeType> GetDataUsingDataContractAsync(CompositeType composite);
    }

    // 定义数据契约（Data Contract）

    /// <summary>
    /// Defines the <see cref="CompositeType" />
    /// </summary>
    public class CompositeType
    {
        /// <summary>
        /// Gets or sets a value indicating whether BoolValue
        /// </summary>
        public bool BoolValue { get; set; }

        /// <summary>
        /// Gets or sets the StringValue
        /// </summary>
        public string StringValue { get; set; }
    }
}
